﻿<%@ Page Language="C#" AutoEventWireup="true" ResponseEncoding="utf-8" CodeBehind="email_wdyj_index.aspx.cs" Inherits="Ccit.OA.Email.email_wdyj_index" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.1" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v8.1" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>

<html > 
<head runat="server">
    <title>我的邮件</title>       
    <link rel="Stylesheet" href="../css/main.css" type="text/css" />
   <script language="javascript" src="../script/jquery.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jsonlib.js" type="text/javascript" ></script>
    <script language="javascript" src="../script/StringClass_Ext.js" type="text/javascript" ></script>
    <script type="text/javascript">
        function doDeleteFolder(fileID,sType) //删除
        {
            if(confirm("确定删除此邮件夹(若删除下边的邮件会一并被清除)?"))
            {

                var jsonStr = jsonObj(fileID,sType);
                PageMethods.DeleteFolders(jsonStr,"DelFolder",ClientCallBack) ;
            }
        }
        
        function doDeleteEmail(fileID,sType)
        {
            if(confirm("确定清除此邮件夹下边的所有邮件?"))
            {
                var jsonStr = jsonObj(fileID,sType);
                PageMethods.DeleteEmail(jsonStr,"ClearEmail",ClientCallBack);
            }
        }
        
        
        function ClientCallBack(vResult) {
            eval("var resultObj=" + vResult);
            var operType = resultObj.operType;
            var resultSign = resultObj.resultSign;
            switch (operType) {
                case "DelFolder": 
                    if (resultSign == "0") {
                        alert("删除失败!");
                    }
                    else {
                        window.location.href = "email_wdyj_index.aspx";
                    }
                    break;
                 case "ClearEmail":
                    if (resultSign == "0") {
                        alert("邮件清除失败!");
                    }
                    else{
                        alert("邮件清除成功!");
                        window.location.href = "email_wdyj_index.aspx";
                    }
                    break;
            }

            resultObj = null;
        }
        
                
        function jsonObj(fileID,sType) //返回序列化后的字符串
        {
            var MsRecord ={};
                MsRecord.Id = "";
                MsRecord.emailId = "";
                MsRecord.userId = $get("hidvar").value;
                MsRecord.folderId = fileID;
                MsRecord.statelogo = sType;
                MsRecord.readlogo = "";
                MsRecord.agencId = "";
                MsRecord.deptId = "";
                MsRecord.jobId = "";
                MsRecord.levelId = "";
                MsRecord.cjuserId = "";
                MsRecord.cjdatetime = "";
                var jsonStr = JSON.stringify(MsRecord,function(key,value){return value;});  
                return jsonStr;
        }
        
        
        function doEditFolder(sparam)//编辑邮件夹
        {
            window.location.href="email_fold_edit.aspx?" + sparam;
            return false;
        }
        
        function doAddEmailFolder()//新增邮件夹
        {
	        var encodeParam = base64encode(sParam);
            window.location.href="email_fold_edit.aspx";
        }
        
        function doAddEmail()// 撰写邮件
        {
             var sParam = "Lastspace="+document.getElementById("hidspacelast").value;
             var encodeParam = base64encode(sParam);
             window.location.href="email_write.aspx?"+encodeParam;
        }
    </script>
    <style type="text/css">
        .style1
        {
            height: 18px;
        }
    </style>
</head>
<body>
  <ccit:ActionForm id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server"></asp:ScriptManager>
         <table class="tbToolbar" cellpadding="0" border="0" cellspacing="0" width="98%" align="center">
            <tr valign="top">

               <td align="left" valign="middle">
                    <div class="tbSeparator"></div>
                </td>
                <td class="titlebar" style="width:100%" valign="middle">
                    我的邮件
                </td>
                <td align="right" valign="middle">
                    <div class="tbSeparator"></div>
                </td>
                <td align="right" valign="middle">
                    <nobr>
                    <a href="javascript:doAddEmail()" class="linktext">
                        <img src="../images/toolbar/addnew_bq.gif" border="0" />撰写新邮件

                    </a>
                    &nbsp;</nobr></td>
                <td align="right" valign="middle">
                    <nobr>
                    <a href="javascript:doAddEmailFolder()" class="linktext">
                        <img src="../images/toolbar/addnew_bq.gif" border="0" />新增邮件夹

                    </a>
                    </nobr>   
                </td>
                <td align="right" valign="middle">
                    <div class="tbSeparator"></div>
                </td>
            </tr>
        </table>
        
        <table cellspacing="0" cellpadding="0" align="center" border="0"  style="WIDTH:98%;HEIGHT:441px">
			<tr height="100%" valign="top">
				<td  width="25%" style="background-color:#EEF2F7; BORDER-RIGHT: #000000 1px solid" id="tdEmailShow" runat="server">
              
				</td>
				<td>
                <dxwgv:ASPxGridView ID="grid" 
                             
                            Width="100%" 
                            AutoGenerateColumns="False" 
                            KeyFieldName="FolderID"
                            Settings-ShowFooter="false"
                            runat="server" onhtmlrowcreated="grid_HtmlRowCreated"    >
                         
              <Columns>     
                <dxwgv:GridViewDataTextColumn Caption="" FieldName="FolderID" Visible="false" ShowInCustomizationForm="false" VisibleIndex="1"></dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn VisibleIndex="2" Width="5%">
                    <DataItemTemplate>
                    <Image src="../images/toolbar/FolderLogo.gif" border="0"></Image>
                    </DataItemTemplate>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="邮件夹名称" FieldName="TITLE" VisibleIndex="3" Width="25%">
                    <HeaderStyle HorizontalAlign="center" />
                    <CellStyle HorizontalAlign="Left"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="新邮件数" FieldName="XYJ" VisibleIndex="4" Width="10%"  >
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="邮件总数" FieldName="FILECOUNT" VisibleIndex="5" Width="10%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="占用空间" FieldName="FILESUM" VisibleIndex="6" Width="18%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="Right"></CellStyle>
                </dxwgv:GridViewDataTextColumn>  
                <dxwgv:GridViewDataTextColumn Caption="有效标志" FieldName="STATE" VisibleIndex="7" Width="12%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn> 
                <dxwgv:GridViewDataTextColumn Caption="类别" FieldName="TYPE" Visible="false" VisibleIndex="7" Width="12%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn> 
                <dxwgv:GridViewDataColumn Caption="操作" VisibleIndex="12" Width="20%">
                    <HeaderStyle HorizontalAlign="center" />
                    <CellStyle HorizontalAlign="center"></CellStyle>
                    <DataItemTemplate>
                      <nobr>
                        <asp:LinkButton ID="lnbModify" runat="server">修改</asp:LinkButton>                        
                        <asp:LinkButton ID="lnbDel" runat="server">删除</asp:LinkButton>
                        <asp:LinkButton ID="lnbDelemail" runat="server">消除邮件</asp:LinkButton>      
                      </nobr>
                    </DataItemTemplate>
                </dxwgv:GridViewDataColumn>                    
                
             
                    </Columns>
            
            
             
            <%-- 设置页脚中分页 --%>
            <SettingsPager PageSize=15 Mode="ShowPager" AlwaysShowPager=false
                 FirstPageButton-Visible=true LastPageButton-Visible=true  
                 FirstPageButton-Image-AlternateText="" LastPageButton-Image-AlternateText="尾页"
                 NumericButtonCount=5  SEOFriendly="Disabled"
                 PrevPageButton-Visible="true" NextPageButton-Visible="true"
                 ShowSeparators=true Position="Bottom">
                    <FirstPageButton Visible="True"></FirstPageButton>
                    <LastPageButton Visible="True">
                    <Image AlternateText="尾页"></Image>
                    </LastPageButton>
            </SettingsPager>
                 
            <%-- 复选框选择脚本事件--%>
            <ClientSideEvents SelectionChanged="function(s,e){OnGridSelectionChanged();}"
                 CustomizationWindowCloseUp="function(s,e){ UpdateCustomizationWindowValue();}"
             />
            
            <%-- 设置行样式--%>
            <Styles>
                <Row CssClass=""></Row>
                <AlternatingRow  CssClass="" Enabled="true"/>
                <SelectedRow  CssClass=""></SelectedRow>                
            </Styles>
            <%--  显示过滤行--%>
            <Settings ShowFilterRow="false" ShowPreview="True"/>
            
            <%-- 可调整列宽--%>
            <SettingsBehavior ColumnResizeMode="Control" />
            
            <%-- 自定义表头--%>
            <SettingsCustomizationWindow Enabled="true" />
        </dxwgv:ASPxGridView>
				</td>
			</tr>
		</table>
		<input type="hidden" id="hidvar"  runat="server"/>
		<input type="hidden" id="hidspacelast" runat="server" />
        </ccit:ActionForm>
</body>
</html>
